<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../css/utils/bootstrap.min.css" />
    <link rel="stylesheet" href="../../css/utils/common.css" />
    <link rel="stylesheet" href="../../css/utils/toastr.min.css" />
	<title></title>
	<style>
		.table {
			margin-left: 1%;
			width: 98%;
		}
		/*-------------头部购买详情 次数------------*/
		.btn-tab {
			margin-top: 50px;
		}
		.input-btn-group {
			width: 382px;
			margin: 40px auto;
		}
		.input-btn-group input[type='text'] {
			float: left;
			width: 300px;
			border-top-right-radius: 0;
			border-bottom-right-radius: 0;
		}
		.input-btn-group .btn {
			background-color: #11B5AB;
			border-color: #11B5AB;
			color: #fff;
			border-top-left-radius: 0;
			border-bottom-left-radius: 0;
		}
		.input-btn-group .btn:focus, .input-btn-group .btn:hover {
			color: #fff;
			background-color: #2aeee2;
			border-color: #2aeee2;
		}
		.label-group .label {
			display: inline-block;
			padding: 3px 25px;
			margin-right: 20px;
			margin-bottom: 20px;
			background-color: #E1E1E1;
			color: #848484;
			cursor: pointer;
			border-top-left-radius: 10px;
			border-top-right-radius: 10px;
			border-bottom-left-radius: 10px;
			border-bottom-right-radius: 10px;
		}
		.label-group .label.active {
			background-color: #11B5AB;
			color: #fff;
		}
		/*-------------修改密码------------*/
		.col-top {
			margin-top: 100px;
		}
		.col-top .form-group {
			margin-bottom: 25px;
		}
		.text-red {
		    color: #ee4747;
		}
		.no-padder {
		    padding: 0 !important;
		}
		.btn-primary:focus, .btn-primary:hover {
			color: #fff;
			background-color: #2aeee2;
			border-color: #2aeee2;
		}
		.btn-primary {
		    color: #fff;
		    background-color: #11B5AB;
		    border-color: #11B5AB;
		}
		.cancle {
			color: #7B7B7B;
			background-color: #F3F3F3;
		    border-color: #F3F3F3;
		}
		/*-------------修改密码------------*/
		/*-------------公众号设置------------*/
		.col-align {
			text-align: center;
		}
		.btn-width {
			padding: 6px 50px;
		}
		#accountModify {
			display: none;
		}
		#payModify {
			display: none;
		}
		/*-------------公众号设置------------*/
		/*---------树----------*/
		.teams-content {
			margin-top: 40px;
			width: 100%;
			height: 745px;
			border: 1px solid #A1A1A1;
		}
		.uiwm-organset-left-header {
		    height: 45px;
		}
		.title-h4 {
			width:175px;
			text-overflow:ellipsis;
			overflow:hidden;
			height:20px;
			white-space:nowrap; 
			margin-top: 15px;
			margin-left: 15px;
		}
		.add-tree-parent {
			margin-top: 16px;
			margin-right: 20px;
			float: right;
            background: url(../../img/myCenter/add_icon.png) no-repeat;
            width: 14px;
            height: 14px;
            background-size: cover;
		}
		.client-details-container {
		    float: left;
			width: 20%;
	        border-color: #A1A1A1;
		    border-width: 0px 1px 0px 0px;
		    border-style: solid;
		}
		.client-details-container .list-group-item:first-child {
		    border-radius: 0px;
		}
		.client-details-container .list-group-item:last-child {
			border-radius: 0px;
		}
		.padder-xs {
		    margin-left: 5px;
		    margin-right: 5px;
		}
		/*.treeview .list-group-item span.click-add{
            display: inline-block;
            background: url(../../img/myCenter/add_icon.png) no-repeat;
            width: 14px;
            height: 14px;
            background-size: cover;
            margin-top: 3px;
        }*/
		.treeview .list-group-item span.click-edit{
            display: inline-block;
            background: url(../../img/myCenter/edit_icon.png) no-repeat;
            width: 14px;
            height: 14px;
            background-size: cover;
            margin-top: 3px;
        }
        .treeview .list-group-item span.click-remove{
            display: inline-block;
            background:url(../../img/myCenter/delete_icon.png) no-repeat;
            width: 14px;
            height: 14px;
            background-size: cover;
            margin-top: 3px;
        }
		/*---------树----------*/
		.table-pane {
			float: right;
			width: 80%;
		}
		.inline-panel {
			margin-left: 1%;
			margin-top: 30px;
			margin-bottom: 30px;
		}
		.form-inline .form-group-input {
			margin-left: 40px;
		    width: 40%;
			display: inline-block;
		    margin-bottom: 0;
		    vertical-align: middle;
		}
		.search-content {
			width: 100%;
		}
		.btn-add-employees {
			margin-right: 20px;
			color: #11B5AB;
			border-radius: 20px;
			border: 1px #11B5AB solid;
		}
		/*----------激活弹框-----------*/
		.QRCode-div {
			margin-left: 217px;
			width: 167px;
			height: 167px;
			background-image: url(../../img/myExtension/checkbox-false.png);
			background-size: 100% 100%;
		}
		.tips-pay {
			width: 640px;
			height: 700px;
		}
		.tips-align {
			text-align: center;
		}
		.tips-pay-div {
			font-size: 16px;
			color: #666666;
			font-family: "MicrosoftYaHei";
		}
		#pwdValidata {
			display: none;
		}
		/*----------激活弹框-----------*/
		/*----------标签编辑弹框-----------*/
		.uiwm-label-input {
		    margin: 40px auto;
		    width: 360px;
		    height: 40px;
		}
		.uiwm-label-input input {
		    border-radius: 0;
		    height: 40px;
		    width: 260px;
		    border-right: none;
		}
		.uiwm-label-input button {
		    width: 100px;
		    height: 40px;
		    background: #11B5AB;
		    border: none;
		    border-radius: 0;
		}
		/*----------标签编辑弹框-----------*/
		.rotate90 {
		    -webkit-transform: rotate(90deg);
		    -ms-transform: rotate(90deg);
		    transform: rotate(90deg);
		}
		.filter-box {
		    display: inline-block;
			position: relative;
		}
		.div-radius0  {
			border-top-left-radius: 16px;
			border-bottom-left-radius: 16px;
		}
		.div-radius1 {
			border-top-left-radius: 0px;
			border-bottom-left-radius: 0px;
		}
		.wechat-qrcode {
			height: 120px;
		}
		.wechat-qrcode label {
		    text-align: right;
    			margin-top: 40px;
		}
	</style>
</head>
<body>
	<div class="content">
		<div class="btn-group btn-group-justified btn-tab" role="group" aria-label="button-group">
			<div id="teamDiv" class="btn-group" role="group">
				<button type="button" panel-data="tab-panel1" class="btn btn-default active">团队设置</button>
			</div>
			<div id="companyDiv" class="btn-group" role="group">
				<button type="button" panel-data="tab-panel2" class="btn btn-default">公司设置</button>
			</div>
			<div id="labelDiv" class="btn-group" role="group">
				<button type="button" panel-data="tab-panel3" class="btn btn-default">标签设置</button>
			</div>
			<div class="btn-group" role="group">
				<button type="button" panel-data="tab-panel4" class="btn btn-default">修改密码</button>
			</div>
			<div class="btn-group" role="group">
				<button type="button" panel-data="tab-panel5" class="btn btn-default">安全退出</button>
			</div>
		</div>
		<div class="tab-content">
			<div id="tab-panel1" class="tab-pane active">
		  		<div class="teams-content">
					<div class="client-details-container">
						<div class="uiwm-organset-left-header">
	                        <a href="#"><h4 class="pull-left title-h4" id="companyNameH4"></h4></a>
	                        <span class="add-tree-parent"></span>
	                    </div>
						<div id="treeview"></div>
					</div>
					<div class="table-pane">
						<div class="inline-panel">
							<div class="form-inline">
								<div class="filter-box">
									<select id="activationSt" class="form-control">
										<option value="">是否激活</option>
										<option value="1">已激活</option>
										<option value="0">未激活</option>
									</select>
								</div>
                                <div class="form-group-input">
                                    <div class="search-content">
                                			<input id="searchInput" type="search" class="form-control" placeholder="输入员工姓名">
								   </div>
                                </div>
                                <a class="btn-add-employees pull-right btn" id="addEmployees">添加员工</a>
                            </div>
						</div>
				  		<table class="table table-bordered table-hover table-striped">
							<thead>
								<tr>
									<th>序号</th>
									<th>姓名</th>
									<th>电话</th>
									<th>岗位</th>
									<th>邮箱</th>
									<th>激活状态</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody id="employeestbody">
							</tbody>
						</table>
						<nav id="employeesPage" class="text-center" aria-label="Page navigation">
							<ul class="pagination">
							</ul>
						</nav>
					</div>
				</div>
			</div>
			<div id="tab-panel2" class="tab-pane">
				<div class="btn-group btn-group-justified btn-tab-sm" role="group" aria-label="button-group">
					<div class="btn-group" role="group">
						<button type="button" panel-data="tab-sm-panel1" class="btn btn-default active">公众号绑定设置</button>
					</div>
					<div class="btn-group" role="group">
						<button type="button" panel-data="tab-sm-panel2" class="btn btn-default">公司支付设置</button>
					</div>
				</div>
				<div class="tab-sm-content">
					<div id="tab-sm-panel1" class="tab-sm-pane active">
						<div id="accountPreview" class="col-md-offset-3 col-md-6 col-top">
							<div class="wechat-qrcode">
								<label class="control-label col-md-5 "> 公司头像：</label>
								<div class="control-label col-md-5">
					                 <img id="companyImg" class="avatar c-p" style="position: absolute; width:100px; height:100px; border-radius: 0;" />
					            </div>
							</div>
							<div class="wechat-qrcode">
								<label class="control-label col-md-5 "> 公众号二维码：</label>
								<div class="control-label col-md-5" title="点击修改二维码">
					                 <img id="qrcodeImg" class="avatar c-p" style="position: absolute; width:100px; height:100px; border-radius: 0;" />
					            </div>
							</div>
							<div class="form-horizontal">
								<div class="form-group col-align">
									<label class="control-label col-md-5"> 微信公众号名称：</label>
									<label id="weChatName" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<label class="control-label col-md-5"> App ID：</label>
									<label id="appId" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<label class="control-label col-md-5"> App Secret：</label>
									<label id="appSecret" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<label class="control-label col-md-5"> 绑定域名：</label>
									<label id="domainName" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<button type="submit" class="btn btn-primary btn-width" data-toggle="modal" data-target="#modifyAccountBindModal">更换绑定</button>
								</div>
							</div>
						</div>
						<div id="accountModify" class="col-md-offset-3 col-md-6 col-top">
							<form class="form-horizontal" id="accountForm">
								<div class="wechat-qrcode">
									<label class="control-label col-md-4 "> 公司头像：</label>
									<div class="col-md-6 upload-btn100" id="qrcodeContainer">
						                 <img id="companyHeaderUploader" class="avatar c-p" style="position: absolute; width:100px; height:100px; border-radius: 0;" />
						                 <input type="hidden" value="" name="companyHeader" id="companyHeader">
						                 <a class="file-a">
						                 	<input type="file" name="eidtorCompanyHeader" value="" accept="image/*" multiple onchange="imgHandleInputChange(this);" />	
						                 </a>
						            </div>
								</div>
								<div class="wechat-qrcode">
									<label class="control-label col-md-4 "> 公众号二维码：</label>
									<div class="col-md-6 upload-btn100" title="点击修改二维码" id="qrcodeContainer">
						                 <img id="qrcodeUploader" class="avatar c-p" style="position: absolute; width:100px; height:100px; border-radius: 0;" />
						                 <input type="hidden" value="" name="companyQrcode" id="companyQrcode">
						                 <a class="file-a">
						                 	<input type="file" name="eidtorQrcode" value="" accept="image/*" multiple onchange="imgHandleInputChange(this);" />	
						                 </a>
						            </div>
								</div>
								<div class="form-group">
									<label for="recipient-name" class="control-label col-md-4"><span class="text-red">*</span> 微信公众号名称：</label>
									<div class="col-md-6 no-padder">
										<input id="weChatNameInput" name="weChatNameInput" class="form-control" placeholder="请输入微信公众号名称" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> App ID：</label>
									<div class="col-md-6 no-padder">
										<input id="appIdInput" name="appIdInput" class="form-control" placeholder="请输入公众号App ID" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> App Secret：</label>
									<div class="col-md-6 no-padder">
										<input id="appSecretInput" name="appSecretInput" class="form-control" placeholder="请输入App Secret" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> 绑定域名：</label>
									<div class="col-md-6 no-padder">
										<input id="domainNameInput" name="domainNameInput" class="form-control" placeholder="请输入绑定域名" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<div class="col-md-offset-4 col-md-6 no-padder">
										<button type="button" id="cancleAccount" class="btn btn-primary btn-width cancle" >取消</button>
										<button type="submit" id="saveAccount" class="btn btn-primary btn-width" >保存</button>
									</div>
								</div>
							</form>
						</div>
					</div>
					<div id="tab-sm-panel2" class="tab-sm-pane">
						<div id="payPreview" class="col-md-offset-3 col-md-6 col-top">
							<div class="form-horizontal">
								<div class="form-group col-align">
									<label class="control-label col-md-5"> 微信支付商户号：</label>
									<label id="paiAccount" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<label class="control-label col-md-5"> API密钥：</label>
									<label id="paiAPIkey" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<label class="control-label col-md-5"> API证书文件(apiclient_cert.p12)：</label>
									<label id="paiAPICert12" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<label class="control-label col-md-5"> API证书文件(apiclient_cert.pem)：</label>
									<label id="paiAPICertpem" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<label class="control-label col-md-5"> API证书文件(apiclient_key.pem)：</label>
									<label id="paiAPIKeypem" class="control-label col-md-5" style="text-align: left;"> </label>
								</div>
								<div class="form-group col-align">
									<button type="submit" class="btn btn-primary btn-width"  data-toggle="modal" data-target="#modifyPayBindModal">更换绑定</button>
								</div>
							</div>
						</div>
						<div id="payModify" class="col-md-offset-3 col-md-6 col-top">
							<form class="form-horizontal" id="payForm">
								<div class="form-group">
									<label for="recipient-name" class="control-label col-md-4"><span class="text-red">*</span> 微信支付商户号：</label>
									<div class="col-md-6 no-padder">
										<input id="paiAccountInput" name="paiAccountInput" class="form-control" placeholder="微信支付商户号" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> API密钥：</label>
									<div class="col-md-6 no-padder">
										<input id="paiAPIkeyInput" name="paiAPIkeyInput" class="form-control" placeholder="请输入公众号App ID" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> API证书文件(apiclient_cert.p12)：</label>
									<div class="col-md-6 no-padder">
										<input type="file" name="APICert12" class="form-control" onchange="handleInputChange(this);" />
										<input id="paiAPICert12Input" name="paiAPICert12Input" type="hidden" class="form-control" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> API证书文件(apiclient_cert.pem)：</label>
									<div class="col-md-6 no-padder">
										<input type="file" name="APICertpem1" class="form-control" onchange="handleInputChange(this);" />
										<input id="paiAPICertpemInput" name="paiAPICertpemInput" type="hidden" class="form-control" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> API证书文件(apiclient_key.pem)：</label>
									<div class="col-md-6 no-padder">
										<input type="file" name="APICertpem2" class="form-control" onchange="handleInputChange(this);" />
										<input id="paiAPIKeypemInput" name="paiAPIKeypemInput" type="hidden" class="form-control" required="required"/>
									</div>
								</div>
								<div id="pwdValidata" class="form-group">
									<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> 登录密码：</label>
									<div class="col-md-6 no-padder">
										<input type="password" id="passwordValidation" name="passwordValidation" class="form-control" placeholder="请输入登录密码验证" required="required"/>
									</div>
								</div>
								<div class="form-group">
									<div class="col-md-offset-4 col-md-6 no-padder">
										<button type="button" id="canclePay" class="btn btn-primary btn-width cancle" >取消</button>
										<button type="submit" id="savePay" class="btn btn-primary btn-width" >保存</button>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
			<div id="tab-panel3" class="tab-pane">
		  		<div class="input-btn-group">
		  			<input type="text" id="lableName" maxlength="6" class="form-control" placeholder="新建标签（限6字）">
		  			<button type="button" class="btn btn-default">新建标签</button>
		  		</div>
		  		<div class="label-group">
				</div>
			</div>
			<div id="tab-panel4" class="tab-pane">
				<div class="col-md-offset-3 col-md-6 col-top">
					<form class="form-horizontal" id="pwdForm">
						<div class="form-group">
							<label for="recipient-name" class="control-label col-md-4"><span class="text-red">*</span> 原密码：</label>
							<div class="col-md-6 no-padder">
								<input type="password" class="form-control" placeholder="请输入原始密码" id="originalPwd" name="originalPwd">
							</div>
						</div>
						<div class="form-group">
							<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> 新密码：</label>
							<div class="col-md-6 no-padder">
								<input type="password" class="form-control" id="new_password" name="new_password" placeholder="请输入6-16位字符的新密码" />
							</div>
						</div>
						<div class="form-group">
							<label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> 确认密码：</label>
							<div class="col-md-6 no-padder">
								<input type="password" class="form-control" id="confirm_password" name="confirm_password" placeholder="请确认您的新密码" />
							</div>
						</div>
						<div class="form-group">
							<div class="col-md-offset-4 col-md-6 no-padder">
								<button type="submit" id="save" class="btn btn-primary btn-width" >保存</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
		<div class="modal fade bs-example-modal-sm" id="modifyAccountBindModal" tabindex="-1" role="dialog" aria-labelledby="modifyAccountBindModalLabel">
	        <div class="modal-dialog modal-sm">
	            <div class="modal-content">
	                <div class="modal-header">
	                	<!--<input type= "hidden"  id = "delArticleId" value=""/>-->
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	                    <h4 class="modal-title">温馨提示</h4>
	                </div>
	                <div class="modal-body">
	                  	  确定要更换绑定吗?更换不成功会影响内容分享发布查阅!
	                </div>
	                <div class="modal-footer">
	                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
	                    <button type="button" class="btn btn-primary" data-dismiss="modal" id="modifyAccountBind">确定</button>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="modal fade bs-example-modal-sm" id="modifyPayBindModal" tabindex="-1" role="dialog" aria-labelledby="modifyPayBindModalLabel">
	        <div class="modal-dialog modal-sm">
	            <div class="modal-content">
	                <div class="modal-header">
	                	<!--<input type= "hidden"  id = "delArticleId" value=""/>-->
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	                    <h4 class="modal-title">温馨提示</h4>
	                </div>
	                <div class="modal-body">
	                  	  确定要更换绑定吗?更换不成功会影响内容商品插件和红包功能的金额往来!
	                </div>
	                <div class="modal-footer">
	                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
	                    <button type="button" class="btn btn-primary" data-dismiss="modal" id="modifyPayBind">确定</button>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="modal fade bs-example-modal-sm" id="startusingAccountModal1" tabindex="-1" role="dialog" aria-labelledby="startusingAccountModalLabel">
	        <div class="modal-dialog">
	            <div class="modal-content tips-pay">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	                </div>
	                <div class="modal-body tips-align">
	                		<div class="tips-pay-div" style="margin-top: 70px;">确认激活用户：Lynx</div>
	                		<div class="tips-pay-div" style="margin-top: 40px;">微信扫码支付</div>
	                		<div class="QRCode-div" style="margin-top: 40px;"></div>
	                		<div class="tips-pay-div" style="margin-top: 50px;">微信在线支付</div>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="modal fade" id="addDepartmentModal" tabindex="-1" role="dialog" aria-labelledby="addDepartmentModalLabel">
	        <div class="modal-dialog" role="document">
	            <div class="modal-content">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	                    <h4 class="modal-title text-base" id="addDepartmentModalLabel">添加部门</h4>
	                </div>
	                <div class="modal-body">
	                    <form class="form-horizontal"  id="deptForm">
	                        <div class="form-group">
	                            <label for="recipient-name" class="control-label col-md-3">上级部门:</label>
	                            <div class="col-md-7 no-padder">
	                                <input type="text" class="form-control input-sm" readonly="readonly" id="parentDepartment">
	                                <input type="hidden" class="form-control input-sm" id="parentDepartmentId">
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label for="message-text" class="control-label col-md-3">部门名称:</label>
	                            <div class="col-md-7 no-padder">
	                              <input type="text" class="form-control input-sm" id="department" maxlength="10"  placeholder="部门名称（最多10个字）"/>
	                              <input type="hidden" class="form-control input-sm" id="departmentId" />
	                            </div>
	                        </div>
	                    </form>
	                </div>
	                <div class="modal-footer">
	                    <button type="button" class="btn btn-default btn-sm padder-md" data-dismiss="modal">取消</button>
	                    <button type="button" class="btn btn-primary btn-sm padder-md" id="saveDeptBtn">保存</button>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="modal fade" id="delDepartmentModal" tabindex="-1" role="dialog" aria-labelledby="delDepartmentModalLabel">
	        <div class="modal-dialog modal-sm" role="document">
	            <div class="modal-content">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	                    <h4 class="modal-title text-base" id="delDepartmentModalLabel">提示</h4>
	                </div>
	                <div class="modal-body">
	                    <p class="text-black text-center"><i class="iconfont icon-wemai14 m-r-sm text-red"></i>您确定删除<span id="delDepartmentName"></span>吗？</p>
	                    <input type="hidden" name="delDepartmentId" id="delDepartmentId" value="">
	                </div>
	                <div class="modal-footer">
	                    <button type="button" class="btn btn-default btn-sm padder-md" data-dismiss="modal">取消</button>
	                    <button type="button" class="btn btn-danger btn-sm padder-md" id="delDeptBtn">删除</button>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="modal fade" id="delEmployeesModal" tabindex="-1" role="dialog" aria-labelledby="delEmployeesModalLabel">
	        <div class="modal-dialog modal-sm" role="document">
	            <div class="modal-content">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	                    <h4 class="modal-title text-base" id="delEmployeesModalLabel">提示</h4>
	                </div>
	                <div class="modal-body">
	                    <p class="text-black text-center"><i class="iconfont icon-wemai14 m-r-sm text-red"></i>您确定删除<span id="delEmployeesName"></span>吗？</p>
	                    <input type="hidden" name="delEmployeesId" id="delEmployeesId" value="">
	                </div>
	                <div class="modal-footer">
	                    <button type="button" class="btn btn-default btn-sm padder-md" data-dismiss="modal">取消</button>
	                    <button type="button" class="btn btn-danger btn-sm padder-md" id="delEmployBtn">删除</button>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="modal fade in" id="editLabelModal" tabindex="-1" role="dialog" aria-labelledby="editLabelModalLabel">
	        <div class="modal-dialog" role="document">
	            <div class="modal-content">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
	                    <h4 class="modal-title text-base" id="editLabelModalLabel">编辑标签</h4>
	                </div>
	                <div class="modal-body">
	                    <div class="uiwm-label-input m-t-sm m-b-sm">
	                        <input type="hidden" id="lableID">
	                        <input type="text" value="" maxlength="6" class="form-control no-shadow pull-left" id="lableTagName" placeholder="编辑标签（限6字）">
	                        <button class="btn btn-primary btn-sm b-l-none pull-left" id="updateLabel" type="button">保存</button>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="modal fade" id="restPwdModal" tabindex="-1" role="dialog" style="display: none;">
	        <div class="modal-dialog modal-sm" role="document">
	            <div class="modal-content">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
	                    <h4 class="modal-title">温馨提示</h4>
	                    <input type="hidden" id="restPwdPhone" />
	                    <input type="hidden" id="restPwdUserID" />
	                </div>
	                <div class="modal-body">
	                    您确定要重置密码吗？重置后密码为手机号后六位数字！
	                </div>
	                <div class="modal-footer">
	                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
	                    <button type="button" class="btn btn-primary" id="restPassword">确定</button>
	                </div>
	            </div>
	        </div>
	    </div>
	    <div class="modal fade" id="addEmployeesModal" tabindex="-1" role="dialog" aria-labelledby="addEmployeesModalLabel">
	        <div class="modal-dialog" role="document">
	            <div class="modal-content">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	                    <h4 class="modal-title text-base" id="addEmployeesModalLabel">编辑员工信息</h4>
	                </div>
	                <div class="modal-body">
	                    <h4 class="text-blue wrapper text-md font-bold m-t-none"></h4>
	                    <form class="form-horizontal" id="addEmployeeForm">
	                        <div class="form-group">
	                            <label for="recipient-name" class="control-label col-md-4"><span class="text-red">*</span> 姓　　名：</label>
	                            <div class="col-md-5 no-padder">
	                                <input type="text" class="form-control input-sm" name="userName" id="userName">
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label for="message-text" class="control-label col-md-4">性　　别：</label>
	                            <div class="col-md-5 no-padder">
	                                <label class="checkbox-inline">
	                                    <input type="radio" value="1" name="sex" id="sex1"><i></i>男
	                                </label>
	                                <label class="checkbox-inline">
	                                    <input type="radio" value="2" name="sex" id="sex2"><i></i>女
	                                </label>
	                                <label class="checkbox-inline">
	                                    <input type="radio" value="0" name="sex" checked="checked" id="sex3"><i></i>保密
	                                </label>
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> 手机号码：</label>
	                            <div class="col-md-5 no-padder">
	                                <input type="text" class="form-control input-sm" name="phone" id="phone"  placeholder="输入您的电话号码" />
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> 部　　门：</label>
	                            <div class="col-md-5 no-padder" style="position:relative">
	                              <select class="form-control input-sm no-shadow m-r-sm" name="departID" id="departID">
	                                  <option value="">请选择部门</option>
	                              </select>
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label for="message-text" class="control-label col-md-4"><span class="text-red">*</span> 职　　位：</label>
	                            <div class="col-md-5 no-padder">
	                                <input type="text" class="form-control input-sm" name="post" id="post" >
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label for="message-text" class="control-label col-md-4"> 邮　　箱：</label>
	                            <div class="col-md-5 no-padder">
	                                <input type="text" class="form-control input-sm" data-rule="email" name="email" id="email">
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label for="message-text" class="control-label col-md-4"> 部门领导：</label>
	                            <div class="col-md-5 no-padder">
	                              <label class="switch-container" style="margin-top: 7px;">
	                                <input type="checkbox" id="isLeader" name="isLeader" />
	                                <i></i>
	                              </label>
	                            </div>
	                        </div>
	                        <div class="form-group">
	                            <label for="message-text" class="control-label col-md-4" style="padding-top:0;"> 系统管理：</label>
	                            <div class="col-md-5 no-padder">
	                              <label class="switch-container">
	                                <input type="checkbox" id="isAdmin" name="isAdmin" />
	                                <i></i>
	                              </label>
	                            </div>
	                        </div>
	
	                        <div class="form-group">
	                            <div class="col-md-offset-4 col-md-5 no-padder m-t-sm m-b-sm">
	                                <input type="hidden" name="userID" id="userID">
	                                <button type="submit" class="btn btn-primary padder-md" id="addEmployeeBtn">保存</button>
	                                <button type="button" class="btn btn-default padder-md m-l-sm" data-dismiss="modal">取消</button>
	                            </div>
	                        </div>
	                    </form>
	                </div>
	            </div>
	        </div>
		</div>
		<div class="modal fade" id="defaultPwdTipsModal" tabindex="-1" role="dialog" style="display: none;">
	        <div class="modal-dialog modal-sm" role="document">
	            <div class="modal-content">
	                <div class="modal-header">
	                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
	                    <h4 class="modal-title">温馨提示</h4>
	                    <input type="hidden" id="restPwdPhone" />
	                    <input type="hidden" id="restPwdUserID" />
	                </div>
	                <div class="modal-body">
	                    该员工的默认密码为手机号后六位数字？
	                </div>
	                <div class="modal-footer">
	                    <button type="button" class="btn btn-default" data-dismiss="modal">知道了</button>
	                </div>
	            </div>
	        </div>
	    </div>
	</div>
	
	<script type="text/javascript" src="../../js/utils/jquery-1.12.4.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/bootstrap.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/bootstrap-treeview.js" ></script>
	<script type="text/javascript" src="../../js/utils/jquery.cookie.js" ></script>
	<script type="text/javascript" src="../../js/utils/jquery.validate.min.js?version=1" ></script>
	<script type="text/javascript" src="../../js/utils/page.js" ></script>
	<script type="text/javascript" src="../../js/utils/boot.js" ></script>
	<script type="text/javascript" src="../../js/utils/toastr.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/depart.js" ></script>
	<script>
		var userID = $.cookie("userID");
		var companyID = $.cookie("companyID");
		var companyName = $.cookie("companyName");
		var isAdmin = $.cookie("isAdmin");
		var wechatID,wechatPayID,isActivate,departID,pageNo=1;
		$(function() {
			toastr.options = {
                "closeButton": true,
                "timeOut": 2000,
                "positionClass": "toast-center"
           	};
           	//1:是管理员 ，0：不是管理员
           	if (isAdmin == 1) {
           		departID = companyID;
				getEmployListData();
				getDepartListData();
           	} else {
           		//获取获取公司全部标签
				getLableList();
           		$("#teamDiv button").removeClass("active");
           		$("#tab-panel1").removeClass("active");
           		$("#teamDiv").hide();
           		$("#companyDiv").hide();
           		$("#labelDiv button").addClass("active");
           		$("#labelDiv button").css({"border-top-left-radius": "16px", "border-bottom-left-radius": "16px"});
           		$("#tab-panel3").addClass("active");
           	}
		})
		function getDepartListData() {//获取部门数据
			base.postData(base.url.getDepartList, {userID:userID,companyID:companyID}, callbackGetDepartList);
		}
		//部门返回
		function callbackGetDepartList(data) {
			if (data.success) {
				$("#companyNameH4").text(data.context.companyName);
				var _parentList = data.context.parentList;
				getDeptsTree(_parentList);//把部分数据填充到树
				//把获取的部门树形结构数据转换成数组
				var _departList = getDepartList(_parentList);
				//获得部门下拉框对象
		        var departmentSt = document.getElementById("departID");
		        //遍历部门数据,并把部门的数据追加到option选项中
		        for (var i=0; i<_departList.length; i++) {
		            var option = document.createElement("option");
		            option.value = _departList[i].sectionID;
		            option.innerHTML = _departList[i].sectionName;
		            departmentSt.appendChild(option);
		        }
			}
		}
		function getDeptsTree(list) {
              $("#treeview").treeview({
                  data: JSON.stringify(list),
                  onNodeAdd: function(e, o) {
                      $("#parentDepartment").val(o.sectionName);
                      $("#parentDepartmentId").val(o.sectionID);
                      $("#department").val("");
                      $("#departmentId").val("");
                      $("#addDepartmentModalLabel").html("添加部门");
                      $('#addDepartmentModal').modal('show');
                  },
                  onNodeEdit: function(e, o) {

                      var p = $('#treeview').treeview('getParent', o);
                      var parentName = typeof(p.sectionName) === "undefined" ? companyName : p.sectionName;
                      $("#parentDepartment").val(parentName);
                      $("#department").val(o.sectionName);
                      $("#departmentId").val(o.sectionID);
                      $("#addDepartmentModalLabel").html("编辑部门");
                      $('#addDepartmentModal').modal('show');
                  },
                  onNodeRemove: function(e, o) {
                      $("#delDepartmentId").val(o.sectionID);
                      $("#delDepartmentName").html(o.sectionName);
                      $('#delDepartmentModal').modal('show');
                  },
                  onNodeSelected: function (e, o) {

                      var out = "<li class='active'>" + o.sectionName + "</li>";
                      var crumbs = "<li> aaa </li>" + getDeptCrumbs(o, out);
                      $("#breadcrumbs").html(crumbs);
                      $("#departmentId").val(o.sectionID);
                      $("#sDepartmentId").val(o.sectionID);
                      departID = o.sectionID;
                      getEmployListData();
                  }
              });
          };
          function getDeptCrumbs(deptId, out) {
              var p = $('#treeview').treeview('getParent', deptId);
              if(typeof(p.sectionID) === "undefined") {
                return out;
              } else {
                return getDeptCrumbs(p, "<li> " + p.sectionName + " </li>" + out);
              }
          }
        //获取员工列表
		function getEmployListData() {
			var data = {
				isActivate: isActivate,
				userName: $("#searchInput").val(),
				departID:departID,
				pageNo: pageNo,
				userID:userID,
				companyID:companyID
			}
			base.postData(base.url.getEmployList, data, callbackgetEmployList);
		}
		function callbackgetEmployList(data) {
			if (data.success) {
				if (pageNo == 1) {
					var _totalPage = Math.ceil(data.context.totalPage/10)||1;
					//初始化分页
					var page = {
						pageIndex:1,//初始页
						currentPage:1,//当前页
						showPage:5,//显示页数
						totalPage:_totalPage,//总页数
						onPageClick: function(page) {
							pageNo = page.currentPage;
							getEmployeeListData();
							$("#employeesPage").initPage(page);
			    			return false;  //默认的翻页事件
					    }
					};
				}
				$("#employeesPage").initPage(page);
				$("#employeestbody").html(getListHtml(data.context.dataList));
			}
		}
		function getListHtml (list) {
			var html = '';
			for (var index in list) {
				html += '<tr>'
				html += '	<td>'+(index*1+1)+'</td>'
				html += '	<td class="employees-name">'+list[index].username+'</td>'
				html += '	<td class="employees-phone">'+list[index].phone+'</td>'
				html += '	<td class="employees-post">'+list[index].post+'</td>'
				html += '	<td class="employees-email">'+list[index].email+'</td>'
				html += '	<td style="display: none;"><span class="employees-sectionId">'+list[index].sectionId+'</span><span class="employees-sex">'+list[index].sex+'</span><span class="employees-isLeader">'+list[index].isLeader+'</span><span class="employees-isAdmin">'+list[index].isAdmin+'</span></td>'
				html += '	<td>'+(list[index].isActivate?"已激活":"未激活")+'</td>'
				html += '	<td><button class="btn btn-default" data-type="1" data-employUserID = "'+list[index].id+'">修改</button><button class="btn btn-default" data-type="2" data-employUserID = "'+list[index].id+'">重置密码</button><button class="btn btn-default" data-type="3" data-employUserID = "'+list[index].id+'">删除</button></td>'
				html += '</tr>'
			}
			return html;
		} 
		$("#pwdForm").validate({
	       	rules:{
	       		originalPwd: {
	       			minlength: 6,
	       			required:true,
	       		},
				new_password:{
					required:true,
				},
				confirm_password:{
					required:true,
					equalTo:"#new_password"    //新密码的id选择器
				}                    
	       	},
	       	messages:{
	       		originalPwd: {
	       			required: "请输入原密码",
	       		},
	          	new_password:{
	               	required: "请输入新密码",
	           	},
	          	confirm_password:{
					required: "请确认新密码",
					equalTo:"两次密码输入不一致"
	           	}                                    
	       },
	       submitHandler: function() {
				var data = {
					userID:userID,
					password:$("#originalPwd").val(),
					newPassword:$("#confirm_password").val()
				}
				base.postData(base.url.updatePassword, data, function(data) {
					if (data.success) {
						$("#originalPwd").val("");
						$("#new_password").val("");
						$("#confirm_password").val("");
						toastr.success(data.msg);
					} else {
						toastr.error(data.msg);
					}
				});
		    }
		})
		$("#accountForm").validate({
	       	rules:{
	       		weChatNameInput: {
	       			required:true,
	       		},
				appIdInput:{
					required:true,
				},
				appSecretInput:{
					required:true,
				},
				domainNameInput:{
					required:true,
				} 
	       	},
	       	messages:{
	       		weChatNameInput: {
	       			required: "请输入公众号名称",
	       		},
	          	appIdInput:{
	               	required: "请输入App ID",
	           	},
	          	appSecretInput:{
					required: "请输入App Secret",
	           	},
	          	domainNameInput:{
					required: "请输入绑定域名",
	           	}                                     
	       },
	       submitHandler: function() {
				var data = {
					id: wechatID,
					userID:userID,
					companyID:companyID,
					wechatName:$("#weChatNameInput").val(),
					appId:$("#appIdInput").val(),
					appSecret:$("#appSecretInput").val(),
					domainName:$("#domainNameInput").val(),
					qrCodeUrl:$("#companyQrcode").val(),
					companyHeadUrl:$("#companyHeader").val()
				}
				base.postData(base.url.addCompanyWeChat, data, function(data) {
					if (data.success) {
						$("#weChatName").text($("#weChatNameInput").val());
						$("#appId").text($("#appIdInput").val());
						$("#appSecret").text($("#appSecretInput").val());
						$("#domainName").text($("#domainNameInput").val());
						$("#accountPreview").show();
						$("#accountModify").hide();
						toastr.success(data.msg);
					} else {
						toastr.error(data.msg);
					}
				});
		    }
		})
		$("#payForm").validate({
	       	rules:{
	       		paiAccountInput: {required:true},
				paiAPIkeyInput: {required:true},
				paiAPICert12Input: {required:true},
				paiAPICertpemInput: {required:true},
				paiAPIKeypemInput: {required:true}
	       	},
	       	messages:{
	       		paiAccountInput: {required: "请输入公众号名称"},
	          	paiAPIkeyInput:{required: "请输入API密钥"},
	          	paiAPICert12Input:{required: "请上传.p12的证书文件"},  
	          	paiAPICertpemInput:{required: "请上传.pem的证书文件"},  
	          	paiAPIKeypemInput:{required: "请上传.pem的证书文件"},  
	       },
	       submitHandler: function() {
	       		var _apiclientCertP12 = $("#paiAPICert12Input").val();
	       		var _apiclientCertPem = $("#paiAPICertpemInput").val();
	       		var _apiclientKeyPem = $("#paiAPIKeypemInput").val();
				var data = {
					id: wechatPayID,
					userID:userID,
					companyID:companyID,
					merchantNo:$("#paiAccountInput").val(),
					apiSecretKey:$("#paiAPIkeyInput").val(),
					apiclientCertP12:_apiclientCertP12,
					apiclientCertPem:_apiclientCertPem,
					apiclientKeyPem:_apiclientKeyPem,
					pwd: $("#passwordValidation").val()
				}
				base.postData(base.url.addCompanyPay, data, function(data) {
					if (data.success) {
						$("#paiAccount").text($("#paiAccountInput").val());
						$("#paiAPIkey").text($("#appIdInput").val());
						if (_apiclientCertP12) {
							if (_apiclientCertP12.indexOf(".p12") != -1) {
								var tempApiclientCertP12 = _apiclientCertP12.split("html")[1];
								$("#paiAPICert12").text(tempApiclientCertP12);
							}
						}
						if (_apiclientCertPem) {
							if (_apiclientCertPem.indexOf(".pem") != -1) {
								var tempApiclientCertPem = _apiclientCertPem.split("html")[1];
								$("#paiAPICertpem").text(tempApiclientCertPem);
							}
						}
						if (_apiclientKeyPem) {
							if (_apiclientKeyPem.indexOf(".pem") != -1) {
								var tempApiclientKeyPem = _apiclientKeyPem.split("html")[1];
								$("#paiAPIKeypem").text(tempApiclientKeyPem);
							}
						}
						$("#payPreview").show();
						$("#payModify").hide();
						toastr.success(data.msg);
					} else {
						toastr.error(data.msg);
					}
				});
		    }
		})
		$("#addEmployeeForm").validate({
	       	rules:{
	       		userName: {required:true},
				phone:{isPhone: true},
				departID:{required:true},
				post:{required:true}
	       	},
	       	messages:{
	       		userName: {required: "请输入姓名"},
	          	phone:{required: "请填写正确的手机号码"},
	          	departID:{required: "请选择部门"},
	          	post:{required: "请输入职位"}
	       },
	       submitHandler: function() {
	       		var formSer = $("#addEmployeeForm").serialize().split("&");
              	var params = {};
              	for(var i=0;i<formSer.length; i++) {
                		var formItem = formSer[i].split("=");
              		params[formItem[0]] = decodeURIComponent(formItem[1]);
              	}
              	params.isAdmin = $("#isAdmin").prop("checked") ? 1:0;
              	params.isLeader = $("#isLeader").prop("checked") ? 1:0;
              	params["companyID"] = companyID;
              	console.log(params);
				base.postData(base.url.addUser, params, function(data) {
					if (data.success) {
						$("#addEmployeesModal").modal("hide");
						$("#defaultPwdTipsModal").modal("show");
						toastr.success(data.msg);
					} else {
						toastr.error(data.msg);
					}
				});
		    }
		})
		function getCompanyWeChatSet () {
			base.postData(base.url.companyWeChatSet, {userID:userID,companyID:companyID}, callbackCompanyWeChatSet);	
		}
		function callbackCompanyWeChatSet(data) {
			if (data.success) {
				wechatID = data.context.companyWeChat.id;
				$("#companyQrcode").val(data.context.companyWeChat.qrCodeUrl);
				$("#companyHeader").val(data.context.companyWeChat.companyHeadUrl);
				$("#qrcodeImg").attr("src", data.context.companyWeChat.qrCodeUrl||"../../img/myExtension/upload_img.png");
				$("#companyImg").attr("src", data.context.companyWeChat.companyHeadUrl||"../../img/myExtension/upload_img.png");
				$("#qrcodeUploader").attr("src", data.context.companyWeChat.qrCodeUrl||"../../img/myExtension/upload_img.png");
				$("#companyHeaderUploader").attr("src", data.context.companyWeChat.companyHeadUrl||"../../img/myExtension/upload_img.png");
				$("#weChatName").text(data.context.companyWeChat.wechatName);
				$("#appId").text(data.context.companyWeChat.appId);
				$("#appSecret").text(data.context.companyWeChat.appSecret);
				$("#domainName").text(data.context.companyWeChat.domainName);
				$("#weChatNameInput").val(data.context.companyWeChat.wechatName);
				$("#appIdInput").val(data.context.companyWeChat.appId);
				$("#appSecretInput").val(data.context.companyWeChat.appSecret);
				$("#domainNameInput").val(data.context.companyWeChat.domainName);
			}
		}
		function getCompanyPaySet () {
			base.postData(base.url.companyPaySet, {userID:userID,companyID:companyID}, callbackCompanyPaySet);	
		}
		function callbackCompanyPaySet(data) {
			if (data.success) {
				wechatPayID = data.context.merchantNumber.id;
				$("#paiAccount").text(data.context.merchantNumber.merchantNo);
				$("#paiAPIkey").text(data.context.merchantNumber.apiSecretKey);
				$("#paiAccountInput").val(data.context.merchantNumber.apiSecretKey);
				$("#paiAPIkeyInput").val(data.context.merchantNumber.apiSecretKey);
				if (data.context.merchantNumber.apiclientCertP12) {
					if (data.context.merchantNumber.apiclientCertP12.indexOf(".p12") != -1) {
						var _apiclientCertP12 = data.context.merchantNumber.apiclientCertP12.split("html")[1];
						$("#paiAPICert12").text(_apiclientCertP12);
						$("#paiAPICert12Input").val(data.context.merchantNumber.apiclientCertP12);
					}
				}
				if (data.context.merchantNumber.apiclientCertPem) {
					if (data.context.merchantNumber.apiclientCertPem.indexOf(".pem") != -1) {
						var _apiclientCertPem = data.context.merchantNumber.apiclientCertPem.split("html")[1];
						$("#paiAPICertpem").text(_apiclientCertPem);
						$("#paiAPICertpemInput").val(data.context.merchantNumber.apiclientCertPem);
					}
				}
				if (data.context.merchantNumber.apiclientKeyPem) {
					if (data.context.merchantNumber.apiclientKeyPem.indexOf(".pem") != -1) {
						var _apiclientKeyPem = data.context.merchantNumber.apiclientKeyPem.split("html")[1];
						$("#paiAPIKeypem").text(_apiclientKeyPem);
						$("#paiAPIKeypemInput").val(data.context.merchantNumber.apiclientKeyPem);
					}
				}
			}
			if (wechatPayID) {
				$("#pwdValidata").show();
			}
		}
		function getLableList() {
			base.postData(base.url.lableList, {userID:userID,companyID:companyID}, callbackLableList);	
		}
		//公司标签列表返回
		function callbackLableList(data) {
			if (data.success) {
				var lableList = data.context.dataList;
				var html = ''
				for (var i=0; i<lableList.length; i++) {
					html += '<span class="label label-default" data-param="'+lableList[i].id+'">'+lableList[i].lableName+'</span>';
				}
				$(".label-group").html(html);
			}
		}
		//编辑标签
		$("#updateLabel").on("click", function(e) {
	    		var _lableTagName = $("#lableTagName").val();
	    		var _lableID = $("#lableID").val();
			base.postData(base.url.edtLable, {lableID:_lableID,lableName:_lableTagName,companyID:companyID}, function(data){
				$('#editLabelModal').modal('hide');
				if (data.success) {
					getLableList();
					toastr.success(data.msg);
				} else {
					toastr.error(data.msg);
				}
			});
        });
        //上传文件
		function handleInputChange(obj){
			var fileData = event.target.files[0];
			if ($(obj).attr("name") == "APICert12") {
				// 检查文件类型
			    if('p12'.lastIndexOf(fileData.name.split(".")[1]) < 0){
			        toastr.warning("文件类型仅支持 p12！");
			        return;
			    }
			} else {
				// 检查文件类型
			    if('pem'.lastIndexOf(fileData.name.split(".")[1]) < 0){
			        toastr.warning("文件类型仅支持 pem！");
			        return;
			    }
			}
			uploadFile(obj,fileData);
		}
		//上传文件
		function uploadFile(obj,files){
			toastr.info("正在上传，请稍等...");
			var formData = new FormData();
			formData.append('type', 1);
			formData.append('file', files);
			formData.append('companyID', companyID);
			$.ajax({
	            url: base.url.fileUpload,
	            method: 'POST',
	            data: formData,
	            contentType: false, // 注意这里应设为false
	            processData: false,
	            cache: false,
	            success: function(data) {
	            		toastr.success("文件上传成功！");
	            		if ($(obj).attr("name") == "APICert12") {
	            			$("#paiAPICert12Input").val(data.context.fileUrl);
	            		} else if ($(obj).attr("name") == "APICertpem1") {
	            			$("#paiAPICertpemInput").val(data.context.fileUrl);
	            		} else {
	            			$("#paiAPIKeypemInput").val(data.context.fileUrl);
	            		}
	            },
	            error: function (jqXHR) {
	                toastr.warning(JSON.stringify(jqXHR));
	            }
	        })
		}
		//删除员工
		$("#delEmployeesModal").on("click", "#delEmployBtn", function() {
			var _userID = $("#delEmployeesId").val();
			base.postData(base.url.delStaff, {companyID:companyID,userID:_userID},function(data) {
				if (data.success) {
					getEmployListData();//刷新数据
					$("#delEmployeesModal").modal("hide");
					toastr.success(data.msg);
				} else {
					toastr.error(data.msg);
				}
			});
		})
		//重置密码
		$("#restPwdModal").on("click", "#restPassword", function() {
			var _phone = $("#restPwdPhone").val();
			var _userID = $("#restPwdUserID").val();
			base.postData(base.url.edtStaffPassword, {companyID:companyID,phone:_phone,userID:_userID},function(data) {
				if (data.success) {
					$("#restPwdModal").modal("hide");
					toastr.success(data.msg);
				} else {
					toastr.error(data.msg);
				}
			});
		})
		//删除部门
		$("#delDepartmentModal").on("click", "#delDeptBtn", function() {
			var _departID = $("#delDepartmentId").val();
			base.postData(base.url.deleteSection, {departID:_departID}, function(data) {
				if (data.success) {
					getDepartListData();
					$('#delDepartmentModal').modal('hide');
					toastr.success(data.msg);
				} else {
					toastr.error(data.msg);
				}
			});
		})
		//添加修改部门
		$("#addDepartmentModal").on("click", "#saveDeptBtn", function() {
			var _departID = $("#departmentId").val();
			var _departName = $("#department").val();
			var _companyID = $("#parentDepartmentId").val();
			base.postData(base.url.addDepart, {departID:_departID,departName:_departName,companyID:_companyID}, function(data) {
				if (data.success) {
					getDepartListData();
					$('#addDepartmentModal').modal('hide');
					toastr.success(data.msg);
				} else {
					toastr.error(data.msg);
				}
			});
		})
		//点击公司搜索
		$("#companyNameH4").on("click", function(e) {
			departID = companyID;
			pageNo = 1;
			getEmployListData();
		})
		$(".add-tree-parent").on("click", function() {
			$("#parentDepartment").val(companyName);//上级部门 公司名称
			$("#parentDepartmentId").val(companyID);//上级部门 公司id
			$("#department").val("");
			$("#departmentId").val("");
			$("#addDepartmentModalLabel").html("添加部门");
			$('#addDepartmentModal').modal('show');
		})
		$("#addEmployees").on("click", function(e) {
			$("#addEmployeesModalLabel").html("添加员工信息");
            $("#userName").val("");
            $("#phone").val("");
            $("#post").val("");
            $("#userID").val("");
			$("#departID option:first").prop("selected", 'selected'); 
            $("#email").val("");
            $("#sex3").prop("checked", "checked");
            $("#isLeader").prop("checked", false);
            $("#isAdmin").prop("checked", false);
            $("#addEmployeesModal").modal("show");
        })
		//修改员工
		$("#employeestbody").on("click", "button", function() {
			var typeID = $(this).data('type');
			var _userID = $(this).attr('data-employUserID');//员工id
			var _phone = $(this).closest("tr").find(".employees-phone").text();
			var _userName = $(this).closest("tr").find(".employees-name").text();
			if (typeID == 1) { //1修改 2重置密码 3删除
				$("#addEmployeesModalLabel").html("编辑员工信息");
				$("#userName").val(_userName);
	            $("#phone").val(_phone);
	            $("#post").val($(this).closest("tr").find(".employees-post").text());
	            $("#userID").val($(this).attr("data-employUserID"));
	            $("#email").val($(this).closest("tr").find(".employees-email").text());
	            $("#sex"+$(this).closest("tr").find(".employees-sex").text()).prop("checked", "checked");
	            $("#isLeader").prop("checked", $(this).closest("tr").find(".employees-isLeader").text() == 1 ? true : false);
	            $("#isAdmin").prop("checked", $(this).closest("tr").find(".employees-isAdmin").text() == 1 ? true : false);
	            var sectionId = $(this).closest("tr").find(".employees-sectionId").text();
	            var departIDSelect = document.getElementById("departID");
				for (var i = 0; i < departIDSelect.options.length; i++){  
			        if (departIDSelect.options[i].value == sectionId){  
			            departIDSelect.options[i].selected = true;  
			            break;  
			        }  
			   	}
	            $("#addEmployeesModal").modal("show");
			} else if (typeID == 2) {
				$("#restPwdPhone").val(_phone);
				$("#restPwdUserID").val(_userID);
				$("#restPwdModal").modal("show");
			} else {
				$("#delEmployeesName").text(_userName);
				$("#delEmployeesId").val(_userID);
				$("#delEmployeesModal").modal("show");
			}
		})
		//搜索
		$('#searchInput').bind('keyup', function(event) {
			if (event.keyCode == "13") {
				console.log("进来了");
	　　　　		//回车执行查询
				$(this).blur();
				pageNo = 1;
				getEmployListData();
		　　	}
		});
		$("#activationSt").change(function() {
			isActivate = $(this).val();
			pageNo = 1;
			getEmployListData();
		})
		$("#modifyAccountBind").on("click", function() {
			$("#accountPreview").hide();
			$("#accountModify").show();
		})
		$("#modifyPayBind").on("click", function() {
			$("#payPreview").hide();
			$("#payModify").show();
		})
		$(".btn-tab").on("click", "button", function(){
			$(".btn-tab button").removeClass("active");
			$(this).addClass("active");
			var panelId = $(this).attr("panel-data");
			if (panelId == "tab-panel1") {
				
			} else if (panelId == "tab-panel2") {
				getCompanyWeChatSet();
			} else if (panelId == "tab-panel3") {
				//获取获取公司全部标签
				getLableList();
			} else if (panelId == "tab-panel4") {
				
			} else {
				//安全退出
				$.cookie("userID", null, {expires: -1, path:"/"});
				$.cookie("menuUrl", null, {expires: -1, path:"/"});
				window.parent.location = "../login.html";
			}
			$(".tab-content .tab-pane").removeClass("active");
			$("#"+panelId).addClass("active");
		});
		$(".btn-tab-sm").on("click", "button", function(){
			$(".btn-tab-sm button").removeClass("active");
			$(this).addClass("active");
			var panelId = $(this).attr("panel-data");
			if (panelId == "tab-sm-panel1") {
				getCompanyWeChatSet();
			} else {
				getCompanyPaySet();
			}
			$(".tab-sm-content .tab-sm-pane").removeClass("active");
			$("#"+panelId).addClass("active");
		});
		//添加标签
		$("#tab-panel3").on("click", "button", function() {
			var _lableName = $("#lableName").val();
			base.postData(base.url.addLable, {lableName:_lableName,companyID:companyID}, callbackAddLable);
		})
		function callbackAddLable(data) {
			if (data.success) {
				getLableList();//重新获取并刷新数据
				toastr.success(data.msg);
			} else {
				toastr.error(data.msg);
			}
		}
		$(".label-group").on("click", "span", function() {
			var lableID = $(this).attr("data-param");
			var lableTagName = $(this).text();
			$("#lableID").val(lableID);
			$("#lableTagName").val(lableTagName);
			$('#editLabelModal').modal('show');
		})
		$("#accountModify").on("click", "#cancleAccount", function() {
			$("#accountPreview").show();
			$("#accountModify").hide();
		})
		$("#payModify").on("click", "#canclePay", function() {
			$("#payPreview").show();
			$("#payModify").hide();
		})
		//上传INPUT图片
		function imgHandleInputChange(obj){
			//先判断是否已有五张图片
			var fileData = event.target.files[0];
			var imgMasSize = 1024 * 1024 * 5; // 5MB
			// 检查文件类型
		    if(['jpeg', 'png', 'gif', 'jpg', 'bmp'].indexOf(fileData.type.split("/")[1]) < 0){
		        toastr.warning("文件类型仅支持 jpeg/png/gif/jpg!");
		        return;
		    }
		    // 文件大小限制
		    if(fileData.size > imgMasSize ) {
		        // 文件大小自定义限制
		        toastr.warning("文件大小不能超过5MB！");
		        return;
		    }
			imgUploadFile(obj,fileData);
		}
		//上传图片
		function imgUploadFile(obj,files){
			toastr.info("正在上传，请稍等...");
			var formData = new FormData();
			formData.append('Filedata', files);
			formData.append('type', 1);
			$.ajax({
	            url: base.url.uploadFile,
	            method: 'POST',
	            data: formData,
	            contentType: false, // 注意这里应设为false
	            processData: false,
	            cache: false,
	            success: function(data) {
	            console.log(data.obj);
	            		pingFileData(obj, data.obj);
	            },
	            error: function (jqXHR) {
	                toastr.warning(JSON.stringify(jqXHR));
	            }
	        })
		}
		function pingFileData(obj, fileUrl){
			if ($(obj).attr("name") == "eidtorCompanyHeader") {
				$("#companyHeader").val(fileUrl);
				$("#companyHeaderUploader").attr("src", fileUrl);
				$("#companyImg").attr("src", fileUrl);
			} else if ($(obj).attr("name") == "eidtorQrcode") {
				$("#companyQrcode").val(fileUrl);
				$("#qrcodeUploader").attr("src", fileUrl);
				$("#qrcodeImg").attr("src", fileUrl);
			}
		}
	</script>
</body>
</html>
